package com.wangyu.talents.common.config;

import com.google.common.collect.Maps;
import java.util.Map;
import org.apache.commons.lang3.RandomUtils;

/**
 * 系统常量类
 *
 * @author zhangQ
 * @create date:2013-11-14
 */
public final class Constants {

  /**
   * 消息key
   */
  public static String MESSAGE = "message";

  /**
   * 错误key
   */
  public static String ERROR = "error";

  /**
   * 上个页面地址
   */
  public static String BACK_URL = "BackURL";

  /**
   * 忽略返回地址
   */
  public static String IGNORE_BACK_URL = "ignoreBackURL";

  /**
   * 当前请求的地址 带参数
   */
  public static String CURRENT_URL = "currentURL";

  /**
   * 当前请求的地址 不带参数
   */
  public static String NO_QUERYSTRING_CURRENT_URL = "noQueryStringCurrentURL";

  /**
   * context path
   */
  public static String CONTEXT_PATH = "ctx";

  public static String STATIC_PATH = "ctxStatic";

  /**
   * 当前登录的用户--前台用户
   */
  public static String CURRENT_USER = "currentUser";

  /**
   * 当前登录的用户--后台用户
   */
  public static String LOGIN_USER = "loginUser";

  /**
   * 验证码参数名称
   */
  public static String CAPTCHA_KEY = "captcha";

  /**
   * 系统初始化密码
   */
  public static String INIT_PASSWORD = "123456";

  /**
   * 当前登录的用姓名
   */
  public static String CURRENT_USERNAME = "username";

  public static String ENCODING = "UTF-8";

  /**
   * 登录错误key
   */
  public static String LOGIN_ERROR_KEY = "loginErrorParam";

  /**
   * 保存全局属性值
   */
  private static Map<String, String> map = Maps.newHashMap();

  /**
   * 显示/隐藏
   */
  public static final String SHOW = "1";
  public static final String HIDE = "0";

  /**
   * 是/否
   */
  public static final String YES = "1";
  public static final String NO = "0";

  /**
   * 对/错
   */
  public static final String TRUE = "true";
  public static final String FALSE = "false";

  private static final String[] COLORS = {"red", "yellow", "aqua", "blue", "light-blue", "green",
      "navy", "teal", "olive", "orange", "fuchsia", "purple", "maroon", "black"};

  /**
   * 产生随机颜色
   */
  public static String randColor() {
    int r = RandomUtils.nextInt(0, COLORS.length - 1);
    return COLORS[r];
  }

}
